# encoding: utf-8
from flask_marshmallow import base_fields
from app.modules.common.parameters import BaseParameters, Parameters


class GetRecordParameters(Parameters):
    plans = base_fields.String(
        description = "查询计划的id列表,多个id用英文逗号隔开",
        missing = None,
        required = False
    )
    start_date = base_fields.DateTime(
        description = "查询开始时间",
        missing = None,
        required = False
    )
    end_date = base_fields.DateTime(
        description = "查询结束时间",
        missing = None,
        required = False
    )
    status = base_fields.String(
        description = "查询的状态",
        enum = ['ALL', 'SUCC', 'FAIL'],
        missing = 'ALL',
        required = False
    )


class DoTestParameters(BaseParameters):
    plan_id = base_fields.String(
        description = "执行测试计划的项目id,也可以是紧急项目或者集成计划id",
        required = True
    )
    plan_name = base_fields.String(
        description = "执行测试计划的项目名称,也可以是紧急项目或者集成计划名称",
        required = True
    )
    agent_id = base_fields.String(
        description = "执行测试agent id",
        required = True
    )
    agent_ip = base_fields.String(
        description = "执行测试agent ip",
        required = True
    )
    case_names = base_fields.String(
        description = "所选所有用例的名称，逗号隔开",
        required = True
    )
    case_ids = base_fields.String(
        description = "所选所有用例的id，逗号隔开",
        missing = None,
        required = False
    )
    tags = base_fields.String(
        description = "要执行的tag",
        missing = None,
        required = False
    )


class UpdateParameters(Parameters):
    id = base_fields.String(
        description = "记录id",
        required = True
    )
    root_case = base_fields.String(
        description = "根case",
        missing = None,
        required = False
    )
    success = base_fields.String(
        description = "成功数",
        missing = None,
        required = False
    )
    fail = base_fields.String(
        description = "失败数",
        missing = None,
        required = False
    )
    report_path = base_fields.String(
        description = "报告路径",
        missing = None,
        required = False
    )
    desc = base_fields.String(
        description = "描述",
        missing = None,
        required = False
    )
